package com.hdu.dwh.dtos.cdc_dtos;

import java.util.List;

import com.hdu.dwh.utils.CDCUtils;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

@Data
public class ActiveRadarCDCDto {
    public ActiveRadarCDCDto(){}

    public ActiveRadarCDCDto(String endpoint, String accessKey, String secretKey, String warehouse, String database, String table, String monitor_dir, Integer duration) {
        this.endpoint = endpoint;
        this.accessKey = accessKey;
        this.secretKey = secretKey;
        this.warehouse = warehouse;
        this.database = database;
        this.table = table;
        this.monitor_dir = monitor_dir;
        this.duration = duration;
    }
    @Schema(hidden = true)
    private String type = "active_radar";

    @Schema(hidden = true)
    private String entryClass = "hdu.dwh.flinkjobs.Source.ActiveRadarSource";

    @Schema(hidden = true)
    private String endpoint;

    @Schema(hidden = true)
    private String accessKey;

    @Schema(hidden = true)
    private String secretKey;

    @Schema(hidden = true)
    private String warehouse;
    
    @Schema(description = "paimon数据库名称", defaultValue = "radar")
    private String database;

    @Schema(description = "paimon表名称", defaultValue = "active_radar")
    private String table;

    @Schema(description = "表描述", defaultValue = "主动雷达")
    private String description;

    @Schema(description = "监控目录", defaultValue = "s3://radar/active_radar/")
    private String monitor_dir;

    @Schema(description = "扫描目录的间隔时间", defaultValue = "30")
    private Integer duration;

    @Schema(hidden = true)
    public List<String> getCDCConfigList() {
        if (this.endpoint == null || this.accessKey == null || this.secretKey == null || this.warehouse == null || this.database == null || this.table == null || this.monitor_dir == null || this.duration == null) {
            throw new IllegalArgumentException("参数不能为空" + this.toString());
        }
        List<String> config = CDCUtils.buildRadarParamList(type, endpoint, accessKey, secretKey, warehouse, database, table, monitor_dir, duration);
        return config;
    }
}
